package com.kaifamiao.cons;

public class Hui {

    public String fullName;
    public char gender;

    // 实例初始化器
    {
        System.out.println( "fullName: " + this.fullName );
        // 初始化实例变量 fullName
        this.fullName = "回族兄弟";
        System.out.println( "fullName: " + this.fullName );
    }

    // 实例初始化器
    {
        System.out.println( "gender: " + this.gender );
        // 初始化实例变量 gender
        this.gender = '男';
        System.out.println( "gender: " + this.gender );
    }

    public Hui(){
        super();
        System.out.println( "无参构造方法执行" );
    }

    public Hui( String fullName, char gender ){
        this();
        System.out.println( "有参构造方法执行" );
        // 将构造方法的参数值赋值给实例变量
        this.fullName = fullName;
        this.gender = gender;
    }

    public static void main(String[] args) {
        Hui h = new Hui( "相爷" , '男' );
        System.out.println( h.fullName );
    }

}
